#include <iostream>
using namespace std;
#include <vector>


//version 1 直接扫描遍历并修改
class Solution {
public:
    string modifyString(string s) {
        int n = s.size();
        for(int i = 0; i < n; ++i){
            if(s[i] == '?'){
                //可能s第一个位置就是?
                char before = '\0', behind = before;
                if(i != 0) before = s[i - 1];
                if(i != n - 1) behind = s[i + 1];

                for(char c = 'a'; c <= 'z'; ++c)
                    if(c != before && c != behind) {
                        s[i] = c;
                        break;
                    }
            }
        }
        return s;
    }
};